home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8877 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What is &Variable (declared as: char Variable[10])?
  5. Date: 6 Mar 1996 12:55:22 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4hku3qINNrok@keats.ugrad.cs.ubc.ca>
  8. References: <4gqpa1$3h9@alcor.usc.edu> <TANMOY.96Feb29100937@qcd.lanl.gov> <4hdtfcINN4l3@keats.ugrad.cs.ubc.ca> <TANMOY.96Mar4081026@qcd.lanl.gov>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <TANMOY.96Mar4081026@qcd.lanl.gov>,
  12. Tanmoy Bhattacharya <tanmoy@qcd.lanl.gov> wrote:
  13. >In article <4hdtfcINN4l3@keats.ugrad.cs.ubc.ca>
  14. >c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  15. >The difference you are trying to make between `value context' and
  16. >`object context' (or `lvalue context') is a good way of understanding
  17. >what is going on. In fact, I prefer this method of explaining it to
  18. >beginners as well; though strictly speaking it is incorrect.
  19.  
  20. Right. The concept ignores the fact that some evaluations are simply undefined,
  21. and that they may have side effects which are not generated if you don't
  22. evaluate. What I should have said more clearly is that the value _type_ is
  23. conceptually generated, not the value itself. For example, in sizeof(array), or
  24. &array it is harmless to think of the expression array has having, at compile
  25. time, an indeterminate _value_, but whose _type_ is surely pointer to T,
  26. whatever the base type is. The code to actually compute the missing pointer to
  27. T is never generated, because the nature of & and sizeof() doesn't call for it.
  28. I did not mean to imply that one should imagine that the expression is
  29. evaluated followed by a dropping of the value.
  30.  
  31. This is a harmless way to think about it that might be suitable for teaching
  32. purposes. It does call upon all kinds of concepts that are probably unfamiliar
  33. to beginner programmers---things like attributes of a parse tree node, concepts
  34. that only come naturally because I have grappled with them in the study of
  35. compiler construction. Perhaps this sort of thing should be taught first. I
  36. would readily whip out parse tree diagrams labelled with attributes if that
  37. would help.
  38. -- 
  39.  
  40.